broadway: Disconnect from the frame clock
authorMatthias Clasen <mclasen@redhat.com>
Fri, 24 May 2019 01:55:23 +0000 (01:55 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 20:25:17 +0000 (20:25 +0000)
The frame clock can no survive its surface,
so we need to disconnect signal handlers.

gdk/broadway/gdksurface-broadway.c

index d8a0ffb44c65fad7b9a89bae5da9d6750a1796c0..a0dbc3036bf0f9d5f4ca9f45f58e58b4e59fe90f 100644 (file)
@@ -184,6 +184,17 @@ connect_frame_clock (GdkSurface *surface)
                     G_CALLBACK (on_frame_clock_after_paint), surface);
 }
 
+static void
+disconnect_frame_clock (GdkSurface *surface)
+{
+  GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
+
+  g_signal_handlers_disconnect_by_func (frame_clock,
+                                        on_frame_clock_before_paint, surface);
+  g_signal_handlers_disconnect_by_func (frame_clock,
+                                        on_frame_clock_after_paint, surface);
+}
+
 GdkSurface *
 _gdk_broadway_display_create_surface (GdkDisplay     *display,
                                       GdkSurfaceType  surface_type,
@@ -254,6 +265,8 @@ _gdk_broadway_surface_destroy (GdkSurface *surface,
 
   impl = GDK_BROADWAY_SURFACE (surface);
 
+  disconnect_frame_clock (surface);
+
   if (impl->node_data)
     g_array_unref (impl->node_data);
   if (impl->node_data_textures)